Skip to content

Conversation

parfeon
Copy link
Contributor

@parfeon parfeon commented Aug 6, 2025

fix(shared-worker): fix issue that didn't handle properly too early heartbeat

Resolved the issue because of which requests that were too early received a response and still have been sent.

refactor(shared-worker): reorganize SharedWorker code

Decouple and re-organize SharedWorker code for better maintainability.

perf(shared-worker): improved subscription state refresh logic

Additional query parameter (removed before sending) is added for requests triggered by user and state will be updated only for these requests.

refactor(logger): avoid similar timestamp in sequential lines

Log entry timestamp will be altered on millisecond if multiple log entries have similar timestamp (logged in fraction of nanoseconds).

refactor(shared-worker): change condition for stalled ping timer

Change the condition that is used to identify whether the offline detection timer has been suspended by the browser or not before trying to evict "offline" PubNub clients.

Decouple and re-organize `SharedWorker` code for better maintainability.

perf(shared-worker): improved subscription state refresh logic

Additional query parameter (removed before sending) is added for requests triggered by user and
state will be updated only for these requests.

refactor(logger): avoid similar timestamp in sequential lines

Log entry timestamp will be altered on millisecond if multiple log entries have similar
timestamp (logged in fraction of nanoseconds).
@parfeon parfeon self-assigned this Aug 6, 2025
@parfeon parfeon added priority: medium This PR should be reviewed after all high priority PRs. type: refactor This PR contains refactored existing features. labels Aug 6, 2025
@pubnub-ops-terraform
Copy link

pubnub-ops-terraform commented Aug 6, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

license/snyk check is complete. No issues have been found. (View Details)

@mohitpubnub
Copy link
Contributor

@parfeon can we have this change in this PR to have changes consolidated to one PR

@parfeon
Copy link
Contributor Author

parfeon commented Aug 7, 2025

@mohitpubnub sure

…` change

Handle the situation when `userId` is changed without proper state changes (unsubscribe, change,
and subscribe back).

fix(shared-worker): fix subscribe/heartbeat aggregation after `auth` change

fix(shared-worker): fix race of conditions with backup timer

Fix race of conditions caused by explicit heartbeat on `auth` change and frequency throttling
logic, which prevented "backup" timer restart.
parfeon and others added 4 commits August 14, 2025 15:19
… next subscribe request takes place only after setToken(). to avoid race condition on checking authtoken vs previous subscribe
Fixed issue when user additionally calls unsubscribe on page unload and it collides with built-in
logic, which invalidates PubNub client from closed tab.

fix(shared-worker): fix issue that didn't handle properly too early heartbeat

Resolved the issue because of which requests that were too early received a response and still have
been sent.

fix(shared-worker): try to fix client timeout timer throttling

Try to resolve issues with timers getting throttled in SharedWorker and actually active PubNub
clients being mistakenly evicted from the state and the state reset for it.
Call 'invalidate' in the client manager only if the client removed in response to the timeout timer
detected that it is inactive.
Adjust the code that is called on identity (`userId`) and auth token change to modify the state
only if values actually have been changed.

refactor(shared-worker): change condition for stalled `ping` timer

Change the condition that is used to identify whether the `offline` detection timer has been
suspended by the browser or not before trying to evict "offline" PubNub clients.
@parfeon parfeon marked this pull request as ready for review August 25, 2025 12:07
@parfeon
Copy link
Contributor Author

parfeon commented Aug 25, 2025

@pubnub-release-bot release

@parfeon parfeon merged commit 30dbcd3 into master Aug 25, 2025
9 checks passed
@parfeon parfeon deleted the refactor/shared-worker branch August 25, 2025 12:54
@pubnub-release-bot
Copy link
Contributor

🚀 Release successfully completed 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: medium This PR should be reviewed after all high priority PRs. type: refactor This PR contains refactored existing features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants